package com.itheima.user.controller;


import com.itheima.common.pojo.Result;
import com.itheima.user.pojo.ApUser;
import com.itheima.user.pojo.ApUserRealname;
import com.itheima.user.service.ApUserRealnameService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.itheima.core.controller.AbstractCoreController;

/**
* <p>
* APP实名认证信息表 控制器</p>
* @author czh
* @since 2021-08-20
*/
@RestController
@RequestMapping("/apUserRealname")
public class ApUserRealnameController extends AbstractCoreController<ApUserRealname> {

    private ApUserRealnameService apUserRealnameService;

    //注入
    @Autowired
    public ApUserRealnameController(ApUserRealnameService apUserRealnameService) {
        super(apUserRealnameService);
        this.apUserRealnameService=apUserRealnameService;
    }

    /**
     * 实名认证驳回
     */
    @PutMapping("/reject/{id}")
    public Result reject(@PathVariable Integer id, @RequestParam String reason){

        boolean flag =  apUserRealnameService.reject(id,reason);
       if (!flag){
           return Result.errorMessage("有点小故障，正在处理中");
       }
        return Result.ok();
    }

    /**
     * 审核通过
     */
    @PutMapping("/pass/{id}")
    public Result pass(@PathVariable Integer id){

       boolean flag =  apUserRealnameService.pass(id);
        if (!flag){
            return Result.errorMessage("有点小故障，正在处理中");
        }
        return Result.ok();

    }




}

